<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/pages/login/common.jsp" %>
<%
String path = request.getContextPath();
%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta content="B2B电商平台" name="description"/>
<meta content="B2B电商平台" name="keyword"/>

<title>B2B电商平台.车辆与配送人员关系维护</title>
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/style.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/btn.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/themes.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/register_icss.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/mmt_trading.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/sweetalert/sweetalert.css" />
<script type="text/javascript" src="<%=path %>/include/js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="<%=path %>/include/js/cookies.js"></script>
<script type="text/javascript" src="<%=path %>/include/js/icss.common.js"></script>
<script type="text/javascript" src="<%=path %>/include/sweetalert/sweetalert.min.js"></script>
<script type="text/javascript" src="<%=path %>/include/sweetalert/sweetalert-dev.js"></script>
<style type="text/css">
#listTable td{
  font-size:12px;
  border: 1px solid #ddd;
  padding: 4px;
}
h2{
width:480px;
}
.noborder{border:none;height:2px;overflow:hidden;}
.noborder td{height: 2px;}
#listTable th{
   border: 1px solid #ddd;
   font-weight: bold;
  
}
.saveButton{
    width:44px;
    height:24px;
    line-height:24px;   
    background-color: transparent;
    background-repeat: no-repeat;
    background-position: 0 -203px;
    border:0;
    cursor:pointer;
    font: 12px/1.5 arial,tahoma,\5b8b\4f53;
    margin: 0 0 0 5px;
    outline:none;
    background-image: url('<%=path%>/include/css/img/xs_bgx.png');   
}
</style>
<script type="text/javascript">
function saveRelation(){
     var userIds =""
   	 $("input[name='userId']").each(function(index,item){
   		 if($(this).attr("checked")=="checked"){
   			 userIds += $(this).val()+",";
       	 }
    })
    if(userIds==""){
	   swal("未选择任何配送人员!");
	    return;
	}else{
		var url = "<%=path%>/vehicleUsers/saveRelation.do?userIds="+userIds;
		fm.action=url;
		fm.submit();
	}
}

</script>
</head>
<body style="font-family: '微软雅黑';padding: 0px;">
	<div id="contentDiv" style="padding:5px; width:99%;margin-left: 0px;">
 		<div style="width:100%;height:30px;border-bottom:1px solid #ADADAD;margin-bottom: 15px;">
	      	<div class="toptil">
	      		<c:if test="${flag eq 'edit'}">选择</c:if><c:if test="${flag eq 'detail'}">查看</c:if>配送人员
			</div>
	    </div>
		<div class="row-fluid dataTables_wrapper" style="margin-top: 5px;" >
			<table id="listTable" class="table table-hover table-nomargin table-bordered usertable dataTable"
			style="width: 100%; border-spacing: 0;">
				<thead>
					<tr class="trBgd" style="background-color: #eee;text-align: center; height: 31px; border: 1px solid #ddd; white-space: nowrap; background-position: 0 -123px; line-height: 30px; font-weight: bold;">
						<c:if test="${flag eq 'edit'}"><th class="span5" nowrap> 选择 </th></c:if>
						<c:if test="${flag eq 'detail'}"><th class="span5" nowrap> 序号 </th></c:if>
						<th class="span15" nowrap> 人员帐号 </th>
						<th class="span15" nowrap> 人员姓名 </th>
						<th class="span15" nowrap> 手机号码 </th>
					</tr>
				</thead>
				<tbody id="list_tbody" style="font-size: 13px">
					<c:if test="${flag eq 'edit'}">
						<c:if test="${not empty usersList}">
							<c:forEach items='${usersList}' var='user' varStatus="st">
							<tr>
								<td class='span5' style="text-align:center;vertical-align:middle;">
									<c:if test="${user.USER_UUID eq user.DELIVER_UUID}">
										<input type='checkbox' name='userId' checked="checked" value='${user.USER_UUID }'>
									</c:if>
									<c:if test="${user.USER_UUID ne user.DELIVER_UUID}">
										<input type='checkbox' name='userId'  value='${user.USER_UUID }'>
									</c:if>
								</td>
								<td class='span15' style="margin:0px;">
									&nbsp;${user.USER_ACCOUNT }
								</td>
								<td class='span15' style="margin:0px;">
									&nbsp;${user.USER_NAME }
								</td>
								<td class='span15' style="margin:0px;text-align:center;">
									&nbsp;${user.USER_TEL }
								</td>
							</tr>
							</c:forEach>
						</c:if>
						<c:if test="${ empty usersList}">
							<tr><td colspan='4' style='text-align:center;color:red;'>暂无数据</td></tr>
						</c:if>
					</c:if>
					<c:if test="${flag eq 'detail'}">
						<c:if test="${not empty usersList}">
							<c:forEach items='${usersList}' var='user' varStatus="st">
							<tr>
								<td class='span5' style="margin:0px;text-align:center;">
									&nbsp;${user.PID }
								</td>
								<td class='span15' style="margin:0px;">
									&nbsp;${user.USER_ACCOUNT }
								</td>
								<td class='span15' style="margin:0px;">
									&nbsp;${user.USER_NAME }
								</td>
								<td class='span15' style="margin:0px;text-align:center;">
									&nbsp;${user.USER_TEL }
								</td>
							</tr>
							</c:forEach>
						</c:if>
						<c:if test="${ empty usersList}">
							<tr><td colspan='4' style='text-align:center;color:red;'>暂无数据</td></tr>
						</c:if>
					</c:if>
				</tbody>
			</table>
			<form id="fm" name="fm" class="form-horizontal" method="post"  novalidate="novalidate">
				<input type="hidden" name="carUuid" id="carUuid" value="${carUuid}"/>
				<c:if test="${flag eq 'edit'}">
					<div style="margin-top:10px;width:100%;text-align:center;">
						<button  type="button" onclick="saveRelation();"  class="saveButton">保存</button>
						<a onclick="window.history.go(-1);" class="btn">取消</a>
					</div>
				</c:if>
				<c:if test="${flag eq 'detail'}">
					<div style="margin-top:10px;width:100%;text-align:center;">
						<a onclick="window.history.go(-1);" class="btn">返回</a>
					</div>
				</c:if>
			</form>
			<div>
				<div style="height: 30px;"></div>
				<div class="clear"></div>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript">
	$(document).ready(function(){
		_reHeight();
	});
	function _reHeight(){
		var main = $(window.parent.document).find("#rightFrame");
		var mainheight = $("#contentDiv").height();
		main.height(mainheight);
	}

</script>
</html>
